package com.ai.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ai.web.service.BgRoleService;
import com.ai.web.vo.BgRoleV;
import com.ai.web.vo.ResultModel;
import com.tiny.persistence.domain.BgRole;
import com.tiny.persistence.repository.BgRoleRepo;

@Service
public class BgRoleServiceImpl extends BaseServiceImpl<BgRole, Integer, BgRoleV> implements BgRoleService  {

    @Autowired
    private BgRoleRepo bgRoleRepo;
    
    @Autowired
    public BgRoleServiceImpl(BgRoleRepo bgRoleRepo) {
        super(bgRoleRepo);
    }

    public BgRoleV getRole(int id) throws Exception {
        return getT(id);
    }

    public ResultModel saveRole(BgRoleV bgroleV) throws Exception {
        
        BgRoleV saveV = saveT(bgroleV);
        
        ResultModel rm = new ResultModel();
        rm.setData(saveV);
        rm.setSuccessCode();
        
        return rm;
    }

    public ResultModel deleteRoles(List<Integer> ids) throws Exception {
        deleteTs(ids);
        
        ResultModel rm = new ResultModel();
        rm.setSuccessCode();
        rm.setMsg("删除成功！");
        
        return rm;
    }
    
    public List<BgRoleV> getRoleList() {
		return bgRoleRepo.getRoleList();
	}
   
}
